//
// Created by martin on 2/8/22.
//

#ifndef MUDUO_TIMERID_H
#define MUDUO_TIMERID_H

#include "muduo/base/copyable.h"

#include <stdint.h>
#include <stddef.h>

namespace muduo
{
namespace net
{
class Timer;

/**
 * An opaque identifier, for canceling Timer.
 */
class TimerId : public muduo::copyable
{
public:
    TimerId()
    : timer_(NULL),
    sequence_(0)
    { }

    TimerId(Timer* timer, int64_t seq)
    : timer_(timer),
    sequence_(seq)
    { }

    // default copy-ctor, dtor and assignment are okay

    friend class TimerQueue;

private:
    Timer* timer_;
    int64_t sequence_;
};

}
}

#endif //MUDUO_TIMERID_H
